import {
    createRouter,
    createWebHashHistory
} from 'vue-router'

import home from '../views/index.vue' //首页
import login from '../views/login.vue' //登录
import systemSettings from '../views/systemSettings/index.vue' //系统设置
import menuManage from '../views/systemSettings/menuManage.vue' //菜单管理
import roleManage from '../views/systemSettings/roleManage.vue' //角色管理
import userManage from '../views/systemSettings/userManage.vue' //用户管理

const router = createRouter({
    history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
    routes: [{
        path: '/',
        redirect: '/index',
    }, {
        path: '/index',
        name: 'index',
        component: home,
        meta: {
            title: '首页'
        },
    }, {
        path: '/login',
        name: 'login',
        component: login,
        meta: {
            title: '登录'
        },
    }, {
        path: '/systemSettings',
        name: 'systemSettings',
        redirect: '/systemSettings/menuManage',
        component: systemSettings,
        meta: {
            title: "系统设置"
        },
        children: [{
            path: 'menuManage',
            name: 'menuManage',
            component: menuManage,
            meta: {
                title: "菜单管理"
            }
        }, {
            path: 'roleManage',
            name: 'roleManage',
            component: roleManage,
            meta: {
                title: "角色管理"
            }
        }, {
            path: 'userManage',
            name: 'userManage',
            component: userManage,
            meta: {
                title: "用户管理"
            }
        }]
    }]
})

export default router